<?php
include ("conn.php");
$skey = $_POST['skey'];
$mode = $_POST['mode'];
$pid = $_POST['pid'];
if($mode=="2"){
	$coid = $_POST['coid'];
}
//验证skey是否存在
$sql="SELECT * FROM user WHERE thirdSession='".$skey."'";
$result = $conn->query($sql);
if ($result->num_rows == 0) {exit('{"code":450}');}
$row = $result->fetch_assoc();
$uid = $row['id'];
//计算被点赞对象的id
if($mode=="1"){
	$objId=$pid;
}
else if($mode=="2"){
	$objId="[".$pid.",".$coid."]";
}
//检查这个skey对应的uid是否已经给这个对象点过赞
$sql="SELECT * FROM likeList WHERE uid=".$uid." AND objId='".$objId."'";
$result = $conn->query($sql);
if ($result->num_rows == 1) {
	//点了返回451
	exit('{"code":451}');
}else{
	echo '{"code":453}';
}

?>